using KernelSyntaxExample.Utils;
using Microsoft.SemanticKernel;

namespace SemanticKernelBlazorDemo.Shared.Services;

public class SummarizerService : ISummarizerService {
    private IKernel _kernel;

    public SummarizerService(IKernelFactory kernelFactory) {
        _kernel = kernelFactory.Produce();
    }

    public  string SummarizeAsync(string ask) {
        var summarizeSkill =
            _kernel.ImportSemanticSkillFromDirectory(
                ProjectFile.GetSkillsFolder(), "SummarizeSkill");
        return _kernel.RunAsync(ask, summarizeSkill["Summarize"]).Result.ToString();
            
    }
}